home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 123
/
(Vol 123) Jan 13 2011.iso
/
Games
/
island_fishing.swf
/
scripts
/
DefineSprite_161
/
frame_1
/
DoAction_2.as
next >
Wrap
Text File
|
2011-01-13
|
1KB
|
56 lines
stop();
acceleration = 50;
newpos = function()
{
ranx = Math.round(Math.random() * 550);
rany = Math.round(Math.random() * 400);
};
newpos();
this.onEnterFrame = function()
{
if(hooked <= 0)
{
if(ranx > this._x)
{
right = 1;
left = 0;
this._xscale = -100;
}
if(ranx < this._x)
{
right = 0;
left = 1;
this._xscale = 100;
}
this._x += (ranx - this._x) / acceleration;
if(this._y > 200)
{
if(right >= 1)
{
myRadians = Math.atan2(rany - this._y,ranx - this._x);
myDegrees = Math.round(myRadians * 180 / 3.141592653589793);
this._rotation = myDegrees;
}
if(left >= 1)
{
myRadians = Math.atan2(rany - this._y,ranx + this._x);
myDegrees = Math.round(myRadians * 180 / 3.141592653589793);
this._rotation = myDegrees;
}
this._y += (rany - this._y) / acceleration;
if(rany <= 175)
{
newpos();
}
}
else
{
this._y += 1;
}
if(_root.tmove >= 1)
{
newpos();
}
}
};